package helper.base.list

object ListToHelper {
    fun List<Double>.toXYData(): Array<DoubleArray> {
        return arrayOf(
            this.indices.map { it.toDouble() }.toDoubleArray(),
            this.toDoubleArray(),
        )
    }

    fun List<Double>.toHistoryMinList(): ArrayList<Double> {
        val res = ArrayList<Double>()
        var min = Double.MAX_VALUE
        this.forEach {
            if (it < min) {
                min = it
            }
            res.add(min)
        }
        return res
    }
}